<?php
print "<pre>";
// Require all classes
require_once 'DbConnector.class.php';
require_once 'Ingredient.class.php';
require_once 'Pizza.class.php';
require_once 'Users.class.php';
require_once 'Order.class.php';

echo "Ceci est un test";

$dbConnector = new DbConnector();
$listePizza = Pizza::getAll();

$domFragment = new DOMDocument();
// $domFragment->formatOutput(true);

foreach($listePizza as $id => $pizza)
{
	$xml = $pizza->getXML($domFragment);
	$domFragment->appendChild($domFragment->importNode($xml,true));
	//var_dump($pizza);
}

// On commande une pizza pour afa?
// Création d'un utilisateur thomas.monzie@gmail.com
$tmz = User::auth("thomas.monzie@gmail.com", 'password');
$afa = User::auth("alex.faura@free.fr", 'password');

var_dump($afa);

$order = new Order($afa->getEmail());
$order->addPizza('1', 'Standard', 1);
$order->addPizza('2', 'Standard', 2);
$order->save();

$orderList = Order::getActive();

$orderList[0]->setStatus('Livree');

Order::cleanup(66);

var_dump($orderList);

print "</pre>";

?>